#!perl -T

use strict;
use warnings;
use Test::More tests => 3;
use Test::BoostUnit qw(:ALL);

my %X_Points = (
ONE => 1,
TWO => 2,
THREE => 3,
FOUR => 4,
FIVE => 5,
SIX => 6,
SEVEN => 7,
);

my %NumSamplesAtX = (
ONE => 2,
TWO => 3,
THREE => 2,
FOUR => 1,
FIVE => 2,
SIX => 1,
SEVEN => 2,
);

my %TotalAtX = (
ONE => 2,
TWO => 6,
THREE => 6,
FOUR => 4,
FIVE => 10,
SIX => 6,
SEVEN => 14,
);

is(linearRegression({COUNT => \%NumSamplesAtX, TOTAL_Y => \%TotalAtX, X_HASH => \%X_Points}),1, "Linear Slope" );

$_ = 2 * $_ foreach values %X_Points;
is(linearRegression({COUNT => \%NumSamplesAtX, TOTAL_Y => \%TotalAtX, X_HASH => \%X_Points}),0.5, "Stretched in X" );

$_ = 2 * $_ foreach values %TotalAtX;
is(linearRegression({COUNT => \%NumSamplesAtX, TOTAL_Y => \%TotalAtX, X_HASH => \%X_Points}),1, "Stretched back in Y" );
